<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .parent{
            width:500px;
            height: 400px;
            border: 1px solid pink;
            margin:0 auto;

            /* 设置弹性盒
            给父元素设置弹性盒后  子元素成为弹性元素  弹性元素沿着主轴方向排列
             */
            display: flex;
            /* 更改主轴排列方向  默认row 水平，column 垂直*/
            /*flex-direction: row;*/
            /*当弹性元素宽度超过父容器宽度是会进行等比例压缩而不是换行显示*/
            /*设置换行显示 */
            /* flex-wrap: wrap;*/
            /*flex-flow: column nowrap;*/
            /* justify-content: center; */
        }
        .child{
            /* width: 100px; */
            flex: 1;
            height: 60px;
            color: aliceblue;
        }
        .second{
            flex: 2;
        }
    </style>
</head>
<body>
    <div class="parent">
        <div class="child" style="background-color: deepskyblue;">弹性元素1</div>
        <div class="child second" style="background-color: blueviolet;">弹性元素2</div>
        <div class="child" style="background-color: crimson;">弹性元素3</div>
        <!-- <div class="child" style="background-color: deepskyblue;">弹性元素1</div>
        <div class="child" style="background-color: blueviolet;">弹性元素2</div>
        <div class="child" style="background-color: crimson;">弹性元素3</div> -->
    </div>
</body>
</html>